#ifndef GAMEBOARDVIEW_H
#define GAMEBOARDVIEW_H

#include <QGLWidget>
#include <QPoint>
#include <Qlist>

class GameBoard;
class GameBoardRendererThread;
class QMouseEvent;
class QTimer;
class GameBoardView : public QGLWidget
{
  Q_OBJECT
  public:
    GameBoardView(GameBoard *board, bool playable=true, QWidget *parent=NULL);
    virtual ~GameBoardView();
    void startRendering(unsigned int frameRate=60);
    void setPlayable(bool playable);
    void setSelected(bool selected);
    bool selected() const;

  protected:
    void resizeEvent(QResizeEvent *e);
    void closeEvent(QCloseEvent *e);
    void mousePressEvent(QMouseEvent *e);
    void mouseMoveEvent(QMouseEvent *e);

  protected:
    QPoint mMouseOverTile;
    QTimer* mFrameTimer;
    int mWidth, mHeight;
    bool mPlayable, mSelected;
    GameBoard *mBoard;
    GameBoardRendererThread *mRendererThread;
};

#endif // GAMEBOARDVIEW_H
